home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Prog / B-C / CArrangeList 1.01ß.sit / About CArrangeList next >
Encoding:
Text File  |  1990-04-14  |  6.4 KB  |  202 lines  |  [TEXT/KAHL]

  1.     The CArrangeList class implements a list much like that produced by
  2. Apple's List Manager. However, the list produced by this class can also
  3. be rearranged as user clicks the mouse. Rows are swapped and redrawn as
  4. the user drags on a row within the list. The CArrangeList class keeps
  5. track of all the rows and instead of flipping their data around in memory,
  6. it keeps a seperate list which acts as an index to the rows.
  7.     This class is still in a ßeta version and still requires quite a bit of
  8. testing. I thought it would be best if other programmers could contribute
  9. ideas while this is being finished up. Any of your comments would be
  10. greatly appreciated.
  11.  
  12.     If you find this class useful, please send what you feel it's worth and
  13.     any comments you have to -
  14.  
  15.         PATRICK DOANE
  16.         89 Fair Street
  17.         Guilford CT, 06437
  18.  
  19. I can also be reached on America Online.
  20.  
  21.     ScreenName - Patrick5
  22.  
  23.     Copyright © 1990, dba Imagination Creations.
  24.     This class can be used in creating source code as long as you copyright
  25.     your software. The source code may not be resold or used in a commercial
  26.     product. The object code can be used in anyway you like.
  27.     
  28. EXPLANATION OF INSTANCE VARIABLES
  29. =================================
  30.  
  31. CPanorama    *itsPanorama - The main drawing environment
  32. CScrollPane    *itsScrollPane - The ScrollPane for itsPanorama
  33. short        hIndent - The indent from the left edge of the row
  34. short        vIndent - The indent up from the bottom edge of the row
  35. short        rows - The number of rows in the ArrangeList
  36. short        rowWidth - The width of each row
  37. short        rowHeight - The height of each row
  38. short        currentSelection - The currently selected row
  39. Boolean        dirty - This tells if the ArrangeList has been rearranged
  40. long        clickTime - The time of the last click (in 60ths of a second)
  41. short        clickRow - The last row clicked in
  42. LongHandle    itsOrder - A handle to the current order of the ArrangeList
  43. LongHandle    itemOffsets - A handle to the offset table showing where each
  44.                           row starts within the itsItems handle
  45. Handle        itsItems - A handle to the straight data used by the
  46.                        ArrangeList
  47. ShortFunc    compareProc - A C Function that is called to compare two rows
  48.                           FORMAT short CompareProc(Ptr aPtr,Ptr bPtr,
  49.                                short aLen,short bLen)
  50.                           RETURNS -1 if aPtr is less than bPtr
  51.                                      0 if aPtr equals bPtr
  52.                                      1 if aPtr is greater than bPtr
  53. VoidFunc    doubleProc - A C Function that is called after a double-click
  54.                          occurs
  55.                          FORMAT void DoubleProc(CArrangeList *theList)
  56.  
  57. EXPLANATION OF INSTANCE METHODS
  58. ===============================
  59. void        IArrangeList(CView *theEnclosure,CBureaucrat *theSupervisor,
  60.                     short theWidth,short theHeight,short theHEncl,
  61.                     short theVEncl,Boolean hasHoriz,Boolean hasVert,
  62.                     Boolean hasSizeBox,short theRows,short theRowWidth,
  63.                     short theRowHeight,ShortFunc theCompareProc,
  64.                     VoidFunc theDoubleProc);
  65.  
  66.     Initializes the ArrangeList. Variables are the same as what is passed
  67.     for a Pane and a ScrollPange except for -
  68.     
  69.         theRowWidth,theRowHeight - the row's width and height;
  70.         theCompareProc,theDoubleProc - Procedures to be called for
  71.                         comparing rows and for when a double click occurs
  72.     
  73.     NOTE - The Size Box is not currently used. It is there for later use.
  74.                     
  75. void        Dispose(void);
  76.  
  77.     Disposes of the ArrangeList's handles,itsPanorama and itsScrollPane.
  78.     
  79. void        GetIndents(short *theHIndent,short *theVIndent);
  80.     
  81.     Gives the instance variables hIndent and vIndent.
  82.  
  83. void        GetRowCount(short *rowCount);
  84.  
  85.     Gives the instance variable rows.
  86.  
  87. void        GetRowDimensions(short *theWidth,short *theHeight);
  88.  
  89.     Gives the instance variables rowWidth and rowHeight.
  90.  
  91. void        GetSelection(short *theSelection);
  92.  
  93.     Gives the currentSelection.
  94.  
  95. Boolean        IsDirty(void);
  96.  
  97.     Returns true if the ArrangeList is dirty, false if not.
  98.  
  99. void        SetIndents(short theHIndent,short theVIndent,
  100.                 Boolean redraw);
  101.  
  102.     Sets the instance variables hIndent and vIndent and if redraw is true,
  103.     will redraw the list.
  104.     
  105. void        SetRowDimensions(short theWidth,short theHeight,
  106.                 Boolean redraw);
  107.  
  108.     Sets the instance variables rowWidth and rowHeight and if redraw is true,
  109.     will redraw the list.
  110.     
  111. void        SetSelection(short theSelection);
  112.  
  113.     Deselects currentSelection, sets the instance variable currentSelection,
  114.     and the selects the currentSelection.
  115.     
  116. void        SetDirty(Boolean isDirty);
  117.  
  118.     Sets the instance variable dirty.
  119.  
  120. void        SetCompareProc(ShortFunc theFunc);
  121.  
  122.     Sets the instance variable compareProc.
  123.  
  124. void        SetDoubleProc(VoidFunc theFunc);
  125.  
  126.     Sets the instance variable doubleProc.
  127.  
  128. void        AddRow(short count,short rowNum,Boolean redraw);
  129.  
  130.     Adds count rows after row rowNum, and if redraw is true, redraws the
  131.     list.
  132.     
  133.     NOTE - AddRow has never been tested with adding rows that are not at
  134.            the end of the list. If this doesn't work please inform me and
  135.            I will fix it right away.
  136.            
  137. void        DeleteRow(short count,short rowNum,Boolean redraw);
  138.  
  139.     Deletes count rows at row rowNum, and if redraw is true, redraws the
  140.     list.
  141.     
  142. void        SetRow(Ptr dataPtr,long dataLen,short rowNum,
  143.                 Boolean redraw);
  144.     
  145.     Sets the row rowNum's data to dataPtr for dataLen bytes. If redraw is
  146.     true, it redraws the list.
  147.  
  148. void        DrawRow(register short rowNum);
  149.  
  150.     Draws row rowNum.
  151.  
  152. void        InvertRow(register short rowNum);
  153.  
  154.     Inverts row rowNum;
  155.  
  156. Boolean        ValidRow(register short rowNum);
  157.  
  158.     Test whether or not, rowNum is a valid row within the list.
  159.     
  160. void        Draw(void);
  161.     
  162.     Draws the entire list.
  163.     
  164. void        DoClick(Point hitPt,short modifierKeys,long when);
  165.  
  166.     Called when the user clicks in the ArrangeList.
  167.  
  168. Ptr            GetRowOffset(register short rowNum);
  169.  
  170.     Returns a Ptr to the offset where row rowNum is stored.
  171.  
  172. long        GetRowSize(register short rowNum);
  173.  
  174.     Returns the size of row rowNum.
  175.  
  176. void        Sort(short left,short right);
  177.  
  178.     Sorts the ArrangeList by calling QuickSort.
  179.  
  180. Boolean        Search(register Ptr dataPtr,register short dataLen,
  181.                 short *theRow)
  182.  
  183.     Searches the list until it finds a row that is greater than or equal
  184.     to dataPtr.
  185.  
  186.  
  187. EXPLANATION OF OTHER OBJECTS USED BY ARRANGELIST
  188. ================================================
  189.  
  190. CListPanorama - the Draw and DoClick procedures merely call the ArrangeList
  191.         procedures by the same name.
  192.  
  193. CArrangeTask - Called when the user clicks in the ArrangeList. Performs
  194.         all rearranging and checks for double clicks.
  195.  
  196.  
  197. EXPLANATION OF OTHER PROCEDURES USED BY ARRANGELIST
  198. ===================================================
  199.  
  200. QuickSort - Sorts the ArrangeList.
  201. CompareItems - Default routine for comparing rows.
  202. DoubleClick - Default routine for double clicking (does nothing)